package com.github.wxiaoqi.security.common.msg;

import lombok.Data;

import java.io.Serializable;

/**
 * @Author: bolei
 * @date: 19:21 2018/12/1
 * @Description: 接口公共返回参数标准
 */

@Data
public class BaseApiResponse<T> implements Serializable {

    private static final long serialVersionUID = -4505655308965878999L;

    //请求成功返回码为：0000
    private static final String successCode = "0000";
    //返回数据
    private T data;
    //返回码
    private String code;
    //返回描述
    private String message;

    //返回成功标识
    private Boolean success;

    public BaseApiResponse(){
        this.success = true;
        this.code = successCode;
        this.message = "请求成功";
    }

    public BaseApiResponse(String code, String message){
        this();
        this.success = false;
        this.code = code;
        this.message = message;
    }
    public BaseApiResponse(String code, String message, T data){
        this();
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public BaseApiResponse(T data){
        this();
        this.data = data;
    }

}
